package com.projectmanagement.helpers.i18n;

import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;

public class Helper {
	public static void setupLayout(AbstractOrderedLayout layout) {
		layout.setMargin(false);
		layout.setSpacing(false);
	}

	public static Window getAutoSizeWindow(String caption) {
		Window subwindow = new Window(caption);
		VerticalLayout layout = (VerticalLayout) subwindow.getContent();
		layout.setMargin(true);
		layout.setSpacing(true);
		layout.setSizeUndefined();
		subwindow.center();
		return subwindow;
	}

	public static String capitalize(String string) {
		if (string.length() == 0)
			return string;
		return string.substring(0, 1).toUpperCase()
				+ string.substring(1);
	}

	public static String decapitalize(String string) {
		if (string.length() == 0)
			return string;
		return string.substring(0, 1).toLowerCase()
				+ string.substring(1);
	}
}
